<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>明细查询</title>
		<link rel="stylesheet" href="__OEM__/css/iconfont.css" />
		<link rel="stylesheet" href="__OEM__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 统计管理 <span class="c-gray en">&gt;</span> 明细查询
			<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
		</nav>

			<div class="index_content clearfix">

				<div class="right"><!--右侧内容-->

					<div class="indrig_con">
						<div class="zizh_conbox" style="padding-top: 20px;">
							<!--选项卡内容开始-->
							<form id="my_form" action="{:url('count/detailed')}" method="post">
							<div class="zizh_con_1">
		
						       <div class="chax_rowbox clearfix">
   									<div class="shxx_row clearfix">
							            <div class="left">OEM：</div>
								            <div class="right clearfix">
							                <div id="htselect">
												<select name="oemname" id='oemname' onchange="oem_change(this.options[this.options.selectedIndex].value)">
													<option value="">全部</option>
													{volist name="oem" id="vo"}
														<option value="{$vo.id}">{$vo.user_name}</option>
													{/volist}
												</select>
											</div>
							            </div>
							        </div>
									<div class="shxx_row clearfix">
							            <div class="left">省代：</div>
								            <div class="right clearfix">
							                <div id="htselect">
												<select name="sdname" id='sdname' onchange="sheng_change(this.options[this.options.selectedIndex].value)">
													<option value="">全部</option>
													{volist name="info_oem" id="vo"}
														<option value="{$vo.id}">{$vo.user_name}</option>
													{/volist}
												</select>
											</div>
							            </div>
							        </div>
							        <div class="shxx_row clearfix">
							            <div class="left">市代：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="sdlist" id='sdlist' onchange="sd_change(this.options[this.options.selectedIndex].value)">
												<option value="">全部</option>
												</select>
											</div>
							            </div>
							        </div>
								</div>
								<div class="chax_rowbox clearfix">
									<div class="shxx_row clearfix">
							            <div class="left">业务员：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="ywylist" id='ywylist' onchange="ywy_change(this.options[this.options.selectedIndex].value)">
												<option value="">全部</option>
												</select>
											</div>
							            </div>
							        </div>
							        <div class="shxx_row clearfix">
							            <div class="left">店铺：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="dplist" id='dplist' onchange="store_change(this.options[this.options.selectedIndex].value)">
												<option value="">全部</option>
												</select>
											</div>
							            </div>
							        </div>
							        <div class="shxx_row clearfix">
							            <div class="left">门店：</div>
							            <div class="right clearfix">
							                <div id="htselect">
												<select name="storelist" id='storelist'>
													<option value="">全部</option>
												</select>
											</div>
							            </div>
							        </div>
								</div>
								<div class="chax_rowbox clearfix">
							        <div class="shxx_row clearfix">
							            <div class="left">支付方式：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="pay_type" id='pay_type'>
												<option value="">全部</option>
												<option value="1">余额</option>
												<option value="2">微信</option>
												<option value="3">支付宝</option>
												<option value="4">银联</option>
												</select>
											</div>
							            </div>
							        </div>
	        						<div class="shxx_row clearfix">
							            <div class="left">交易状态：</div>
							            <div class="right clearfix">
											<div id="htselect">
												<select name="state" id="state">
													<option value="">全部</option>
													<option value="2">已付</option>
													<option value="1">未付</option>
												</select>
											</div>
							            </div>
							        </div>
						        	<div class="shxx_row chax_row clearfix">
							            <div class="left">订单号：</div>
							            <div class="right clearfix">
							                <input type="text" name="order_sn" id="order_sn" placeholder="订单号" class="chax_input" />
						          	 	</div>
					      		  </div>
								</div>
								<div class="chax_rowbox clearfix">
							        <button type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
								</div>
								</form>
								<div class="chax_conbox">
									<div class="chax_jiegbt clearfix">
										<div class="chax_jieg">消费金额：<?php echo $xfprice ?>元 ,实际金额：<?php echo $sjprice ?>元 ； 赠送：<?php echo $zsscore ? $zsscore:0.00 ?>元,抵扣：<?php echo $dkscore ? $dkscore:0.00 ?>元</div>
										<div class="chax_xzbtnbox">
											<a href="#" onclick="check()"><i class="iconfont icon-daochu"></i>导出</a>
										</div>
									</div>
									<div class="chax_jiegnr">
										<table class="zizh_table1">
											<thead>
												<tr>
													<th class="w_15">订单号</th>													
													<th class="w_20">店铺/门店</th>
													<th class="w_10">项目</th>
													<th class="w_10">支付方式</th>
													<th class="w_10">消费金额</th>
													<th class="w_10">实际金额</th>
													<th class="w_10">赠送/抵扣</th>
													<th class="w_15">日期</th>
												</tr>
											</thead>
											<tbody id="tbody">
												{volist name="paylog" id="vo"}
												<tr>
													<td>{$vo.order_sn}</td>													
													<td>{$vo.agent_name}/{$vo.store_name}</td>
													<td>
													{switch name="$vo.order_type"}
													    {case value="1"}订单{/case}
													    {case value="2"}扫码{/case}
													    {case value="3"}充值{/case}
													    {case value="4"}广告充值{/case}
													    {case value="5"}积分充值{/case}
													    {case value="6"}线下收银{/case}
													    {default /}订单
													{/switch}
													</td>
													<td>
													{switch name="$vo.pay_type"}
													    {case value="1"}余额{/case}
													    {case value="2"}微信{/case}
													    {case value="3"}支付宝{/case}
													    {default /}银联
													{/switch}
													</td>
													<td>{$vo['origin_price']}</td>
													<td>{$vo['balance']}</td>
													<td>
														{if $vo.payment_type==1}
														+
														{elseif $vo.payment_type==2}
														-
														{else/}
														{/if}
														{$vo['score']}
													</td>
													<td>{$vo.add_time}</td>
												</tr>
												{/volist}
											</tbody>
										</table>
										<div class="fenye" style="display: block;">
											{$paylog->render()}
										</div>
		
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>

		{include file="public/footer" /}
		
	</body>

</html>
<script type="text/javascript">
	layui.use('laydate', function(){
		var laydate = layui.laydate;
		
		//日期控件
		laydate.render({
		    elem: '#begin_time'
		    ,type: 'datetime'
		    ,format: 'yyyy-MM-dd HH:mm:ss'
		});
		  
		laydate.render({
		    elem: '#end_time'
		    ,type: 'datetime'
		    ,format: 'yyyy-MM-dd HH:mm:ss'
		});
	})
	
	//切换OEM
	function oem_change(id){
		 $.ajax({
             	type:"post",
                url:"{:url('count/sdname')}",
                data: {
                	id:id
                },
                success:function(data){  
                	var sdlist = data.data;
                    var select_htm = '';
					if(sdlist && sdlist.length<1){
						select_htm = "<option value=''>全部</option>";
					}else{
						select_htm = "<option value=''>全部</option>";
						for(var i=0;i<sdlist.length;i++){
							select_htm += "<option value='"+sdlist[i].id+"'>"+sdlist[i].user_name+"</option>";
						}
					}

					$('#sdname').empty();
					$('#sdname').append(select_htm);

                },error:function(data){
                	var a = data;
                }
        });
	}
	
	
	//切换省代
	function sheng_change(id){
		 $.ajax({
             	type:"post",
                url:"{:url('count/sdlist')}",
                data: {
                	id:id
                },
                success:function(data){  
                	var sdlist = data.data;
                    var select_htm = '';
					if(sdlist && sdlist.length<1){
						select_htm = "<option value=''>全部</option>";
					}else{
						select_htm = "<option value=''>全部</option>";
						for(var i=0;i<sdlist.length;i++){
							select_htm += "<option value='"+sdlist[i].id+"'>"+sdlist[i].user_name+"</option>";
						}
					}

					$('#sdlist').empty();
					$('#sdlist').append(select_htm);

                },error:function(data){
                	var a = data;
                }
        });
	}
	
	
	//切换市代
	function sd_change(id){
		 $.ajax({
             	type:"post",
                url:"{:url('count/ywylist')}",
                data: {
                	id:id
                },
                success:function(data){  
                	var ywylist = data.data;
                    var select_htm = '';
					if(ywylist && ywylist.length<1){
						select_htm = "<option value=''>全部</option>";
					}else{
						select_htm = "<option value=''>全部</option>";
						for(var i=0;i<ywylist.length;i++){
							select_htm += "<option value='"+ywylist[i].id+"'>"+ywylist[i].name+"</option>";
						}
					}
					console.log(select_htm);
					$('#ywylist').empty();
					$('#ywylist').append(select_htm);
					
					var dplist = data.datas;
                    var select_htms = '';
					if(dplist && dplist.length<1){
						select_htms = "<option value=''>全部</option>";
					}else{
						select_htms = "<option value=''>全部</option>";
						for(var i=0;i<dplist.length;i++){
							select_htms += "<option value='"+dplist[i].id+"'>"+dplist[i].agent_name+"</option>";
						}
					}
					
					$('#dplist').empty();
					$('#dplist').append(select_htms);

                },error:function(data){
                	var a = data;
                }
        });
	}
	
	//切换店铺
	function store_change(id){
		 $.ajax({
             	type:"post",
                url:"{:url('count/storelist')}",
                data: {
                	id:id
                },
                success:function(data){  
                	var storelist = data.data;
                    var select_htm = '';
					if(storelist && storelist.length<1){
						select_htm = "<option value=''>全部</option>";
					}else{
						select_htm = "<option value=''>全部</option>";
						for(var i=0;i<storelist.length;i++){							
							select_htm += "<option value='"+storelist[i].id+"'>"+storelist[i].store_name+"</option>";
						}
					}
					$('#storelist').empty();
					$('#storelist').append(select_htm);

                },error:function(data){
                	var a = data;
                }
        });
	}
	
	function check() {	
		var storelist = $('#storelist').val();
		var sdname = $('#sdname').val();
		var sdlist = $('#sdlist').val();
		var ywylist = $('#ywylist').val();
		var dplist = $('#dplist').val();
		var oemname = $('#oemname').val();
		var pay_type = $('#pay_type').val();
		var order_sn = $('#order_sn').text();
		window.location.href = "/admin/count/detail_dc.html?storelist=" + storelist + "&oemname=" + oemname + "&sdname=" + sdname + "&ywylist=" + ywylist
		+ "&ywylist=" + ywylist+ "&dplist=" + dplist+ "&pay_type=" + pay_type+ "&order_sn=" + order_sn;
	}
</script>